package org.tabcap.res;

import java.awt.image.BufferedImage;
import java.util.HashMap;

import javax.swing.ImageIcon;

import com.meg.swing_utils.graphics.AWTLoader;

public class ImageCache
{
	private static String[][] images = new String[][] {
				{ "TabCap Icon", "org/tabcap/res/Icon.png" },
				{ "About Background", "org/tabcap/res/about/About Background.png" }
			};
	
	private static String[][] icons = new String[][] {
				{ "New", "org/tabcap/res/buttons/New.png" },
				{ "Open", "org/tabcap/res/buttons/Open.png" },
				{ "Save", "org/tabcap/res/buttons/Save.png" },
				{ "Cut", "org/tabcap/res/buttons/Cut.png" },
				{ "Copy", "org/tabcap/res/buttons/Copy.png" },
				{ "Paste", "org/tabcap/res/buttons/Paste.png" },
				{ "Run", "org/tabcap/res/buttons/Run.png" },
				{ "Compile", "org/tabcap/res/buttons/Debug.png" },
				{ "Help", "org/tabcap/res/buttons/Help.png" },
				{ "Close Tab", "org/tabcap/res/buttons/Tab Exit.png" },
			};
	
	private HashMap<String, BufferedImage> imageMap;
	public BufferedImage getImage(String image) { return imageMap.get(image); }

	private HashMap<String, ImageIcon> iconMap;
	public ImageIcon getIcon(String icon) { return iconMap.get(icon); }
	
	public ImageCache()
	{
		imageMap = new HashMap<String, BufferedImage>();
		for(String[] image : images)
			imageMap.put(image[0], AWTLoader.loadImage(image[1]));
		iconMap = new HashMap<String, ImageIcon>();
		for(String[] icon : icons)
			iconMap.put(icon[0], AWTLoader.loadIcon(icon[1]));
	}
}